package model.purchasing;
// Generated Nov 12, 2012 11:08:52 PM by Hibernate Tools 3.2.1.GA


import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import model.publics.Supplier;
import org.hibernate.annotations.Cascade;

/**
 * OrderMst generated by hbm2java
 */
@Entity
@Table(name="trs_order_mst", schema="purchasing")
public class OrderMst implements java.io.Serializable {

     private Long id;
     private String transNum;
     private Date transDate;
     private Long autoId;
     private Long revisedId;
     private Supplier supplier;
     private Boolean pkp;
     private Integer leadTime;
     private Integer addTop;
     private Integer top;
     private String divisi;
     private BigDecimal subtotal;
     private BigDecimal diskon;
     private BigDecimal ppn;
     private BigDecimal total;
     private Integer statusId;
     private String userId;
     private String notes;
     private Boolean holding;
     private String insertedLog;
     private String updatedLog;
     private String printedLog;
     private List<OrderDetail> orderDetails;

    public OrderMst() {
        this.orderDetails = new ArrayList<>();
        this.orderDetails.add(new OrderDetail());
    }
   
    @Id 
    @SequenceGenerator(name="order_seq", sequenceName="purchasing.trs_order_mst_id_seq", allocationSize=1)
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="order_seq")
    @Column(name="id", unique=true, nullable=false)
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    @Column(name="trans_num", length=30)
    public String getTransNum() {
        return this.transNum;
    }
    
    public void setTransNum(String transNum) {
        this.transNum = transNum;
    }
    @Temporal(TemporalType.DATE)
    @Column(name="trans_date", length=13)
    public Date getTransDate() {
        return this.transDate;
    }
    
    public void setTransDate(Date transDate) {
        this.transDate = transDate;
    }
    
    @Column(name="auto_id")
    public Long getAutoId() {
        return this.autoId;
    }
    
    public void setAutoId(Long autoId) {
        this.autoId = autoId;
    }
    
    @Column(name="revised_id")
    public Long getRevisedId() {
        return this.revisedId;
    }
    
    public void setRevisedId(Long revisedId) {
        this.revisedId = revisedId;
    }
    
    @Column(name="pkp")
    public Boolean getPkp() {
        return this.pkp;
    }

    @ManyToOne(fetch= FetchType.LAZY)
    @JoinColumn(name="supplier_id")
    public Supplier getSupplier() {
        return supplier;
    }

    public void setSupplier(Supplier supplier) {
        this.supplier = supplier;
    }

    @Column(name="holding")
    public Boolean getHolding() {
        return holding;
    }

    public void setHolding(Boolean holding) {
        this.holding = holding;
    }
    
    public void setPkp(Boolean pkp) {
        this.pkp = pkp;
    }
    
    @Column(name="lead_time")
    public Integer getLeadTime() {
        return this.leadTime;
    }
    
    public void setLeadTime(Integer leadTime) {
        this.leadTime = leadTime;
    }
    
    @Column(name="add_top")
    public Integer getAddTop() {
        return this.addTop;
    }
    
    public void setAddTop(Integer addTop) {
        this.addTop = addTop;
    }
    
    @Column(name="top")
    public Integer getTop() {
        return this.top;
    }
    
    public void setTop(Integer top) {
        this.top = top;
    }
    
    @Column(name="divisi", length=5)
    public String getDivisi() {
        return this.divisi;
    }
    
    public void setDivisi(String divisi) {
        this.divisi = divisi;
    }
    
    @Column(name="subtotal", precision=13)
    public BigDecimal getSubtotal() {
        return this.subtotal;
    }
    
    public void setSubtotal(BigDecimal subtotal) {
        this.subtotal = subtotal;
    }
    
    @Column(name="diskon", precision=13)
    public BigDecimal getDiskon() {
        return this.diskon;
    }
    
    public void setDiskon(BigDecimal diskon) {
        this.diskon = diskon;
    }
    
    @Column(name="ppn", precision=13)
    public BigDecimal getPpn() {
        return this.ppn;
    }
    
    public void setPpn(BigDecimal ppn) {
        this.ppn = ppn;
    }
    
    @Column(name="total", precision=13)
    public BigDecimal getTotal() {
        return this.total;
    }
    
    public void setTotal(BigDecimal total) {
        this.total = total;
    }
    
    @Column(name="status_id")
    public Integer getStatusId() {
        return this.statusId;
    }
    
    public void setStatusId(Integer statusId) {
        this.statusId = statusId;
    }
    
    @Column(name="user_id", length=20)
    public String getUserId() {
        return this.userId;
    }
    
    public void setUserId(String userId) {
        this.userId = userId;
    }
    
    @Column(name="notes", length=200)
    public String getNotes() {
        return this.notes;
    }
    
    public void setNotes(String notes) {
        this.notes = notes;
    }
    
    @Column(name="inserted_log", length=50)
    public String getInsertedLog() {
        return this.insertedLog;
    }
    
    public void setInsertedLog(String insertedLog) {
        this.insertedLog = insertedLog;
    }
    
    @Column(name="updated_log", length=50)
    public String getUpdatedLog() {
        return this.updatedLog;
    }
    
    public void setUpdatedLog(String updatedLog) {
        this.updatedLog = updatedLog;
    }
    
    @Column(name="printed_log", length=50)
    public String getPrintedLog() {
        return this.printedLog;
    }
    
    public void setPrintedLog(String printedLog) {
        this.printedLog = printedLog;
    }
    
//    @OneToMany(cascade=CascadeType.ALL, mappedBy="orderMst")
//    @LazyCollection(LazyCollectionOption.FALSE)
//    @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    
    @OneToMany(cascade=CascadeType.ALL, fetch= FetchType.LAZY, mappedBy="orderMst")
    @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    //@OrderBy("id.seq")
    public List<OrderDetail> getOrderDetails() {
        return this.orderDetails;
    }
    
    public void setOrderDetails(List<OrderDetail> orderDetails) {
        this.orderDetails = orderDetails;
    }


}


